package com.fantabest.common.client;

import com.extjs.gxt.ui.client.GXT;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.util.Theme;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;

public class CommonEntryPoint implements EntryPoint {

	/**
	 * The message displayed to the user when the server cannot be reached or
	 * returns an error.
	 */
	private static final String SERVER_ERROR = "An error occurred while "
			+ "attempting to contact the server. Please check your network "
			+ "connection and try again.";

	/**
	 * Create a remote service proxy to talk to the server-side Greeting
	 * service.
	 */
	private final LoginServiceAsync loginService = GWT.create(LoginService.class);

	private final PlayerServiceAsync playerService = GWT.create(PlayerService.class);
	
	private final SeasonServiceAsync seasonService = GWT.create(SeasonService.class);
	
	private final TeamServiceAsync teamService = GWT.create(TeamService.class);


	public void onModuleLoad() {
		GXT.setDefaultTheme(Theme.BLUE, true);
		FantaBestConstants constants = (FantaBestConstants) GWT
				.create(FantaBestConstants.class);
		Registry.register(RegistryKeys.CONSTANTS, constants);

		FantaBestMessages messages = (FantaBestMessages) GWT
				.create(FantaBestMessages.class);
		Registry.register(RegistryKeys.MESSAGES, messages);

		// Registro i servizi
		Registry.register(RegistryKeys.LOGIN_SERVICE, loginService);
		Registry.register(RegistryKeys.PLAYER_SERVICE, playerService);
		Registry.register(RegistryKeys.SEASON_SERVICE, seasonService);
		Registry.register(RegistryKeys.TEAM_SERVICE, teamService);
	}

}
